//
//  CollectTableViewCell.m
//  A_program
//
//  Created by dlios on 15-5-29.
//  Copyright (c) 2015年 BayMax. All rights reserved.
//

#import "CollectTableViewCell.h"
#import "NovelModel.h"
#import "MyCancleButton.h"

@implementation CollectTableViewCell
- (void)dealloc
{
    [super dealloc];
}
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self setBackgroundColor:[UIColor colorWithWhite:0.9 alpha:0.9]];
        self.selectionStyle = UITableViewCellSelectionStyleNone;
        self.myView = [[UIView alloc]initWithFrame:CGRectMake(0, 0, [UIScreen mainScreen].bounds.size.width, [UIScreen mainScreen].bounds.size.height/6 - 20)];
        [self addSubview:self.myView];
        [self.myView setBackgroundColor:[UIColor whiteColor]];
        [self createDetailsCell];
        [self.myView release];

    }
    return self;
}
- (void)createDetailsCell{
    self.collectImageView = [[UIImageView alloc]initWithFrame:CGRectMake(0, 0, [UIScreen mainScreen].bounds.size.width/3.5, [UIScreen mainScreen].bounds.size.height/6 - 20)];
    [self.myView addSubview:self.collectImageView];
    [self.collectImageView release];
    self.collectTitleImageView = [[UIImageView alloc]initWithFrame:CGRectMake([UIScreen mainScreen].bounds.size.width/3.5 + 10, 10, 30, 30)];
    self.collectTitleImageView.image = [UIImage imageNamed:@"title2.png"];
    [self.myView addSubview:self.collectTitleImageView];
    [self.collectTitleImageView release];
    
    self.collectTitleLable = [[UILabel alloc]initWithFrame:CGRectMake([UIScreen mainScreen].bounds.size.width/3.5+5, 10, [UIScreen mainScreen].bounds.size.width/3.5*2.5-10, 30)];
    [self.myView addSubview:self.collectTitleLable];
    [self.collectTitleLable release];

    self.cancelTitlleButton = [[MyCancleButton alloc]initWithFrame:CGRectMake(self.frame.size.width - 50, 30, 50, 50)];
    [self.cancelTitlleButton setImage:[UIImage imageNamed:@"delete.png"] forState:UIControlStateNormal];
    [self.cancelTitlleButton addTarget:self action:@selector(cancelTitlleButtonAction:) forControlEvents:UIControlEventTouchUpInside];
    [self addSubview:self.cancelTitlleButton];
    [self.cancelTitlleButton release];
    
       
}

- (void)createCellData:(NovelModel *)novelModel{
    self.cancelTitlleButton.cancelId =  novelModel.albumIdMin;
    self.collectTitleLable.text = novelModel.title;
    
}

//删除按钮的
- (void)cancelTitlleButtonAction:(id)sender{
      MyCancleButton *button = sender;
    [self.cancelDelegate createCancleTitleButton:button.cancelId];
    
}

- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
